//
//  TopicPageCell.m
//  Alltelevisionnews
//
//  Created by dllo on 15/11/26.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "TopicPageCell.h"

@implementation TopicPageCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}


- (void)createView {
    
    self.picImage = [[UIImageView alloc] init];
    [self.contentView addSubview:self.picImage];
    
    self.titleLabel = [[UILabel alloc] init];
    self.titleLabel.font = [UIFont systemFontOfSize:20];
    self.titleLabel.numberOfLines = 0;
    [self.contentView addSubview:self.titleLabel];
    
    self.topicLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.topicLabel];
    
    self.talkLabel = [[UILabel alloc] init];
    self.talkLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:self.talkLabel];
    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    [self.picImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).with.offset(10);
        make.top.equalTo(self.contentView).with.offset(5);
        make.bottom.equalTo(self.contentView).with.offset(-5);
        make.right.equalTo(self.titleLabel.mas_left).with.offset(-10);
        make.width.mas_equalTo(100);
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.left.equalTo(self.picImage.mas_right).with.offset(10);
        make.right.equalTo(self.contentView).with.offset(-10);
        make.top.equalTo(self.contentView).with.offset(7);
        make.bottom.equalTo(self.topicLabel.mas_top).with.offset(-10);
        
    }];
    
    [self.topicLabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.left.equalTo(self.picImage.mas_right).with.offset(10);
        make.right.equalTo(self.contentView).with.offset(-150);
        make.bottom.equalTo(self.contentView).with.offset(-6);
        make.top.equalTo(self.titleLabel.mas_bottom).with.offset(10);
    }];
    
    [self.talkLabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.right.equalTo(self.contentView).with.offset(-10);
        make.left.equalTo(self.topicLabel.mas_right).with.offset(50);
        make.top.equalTo(self.titleLabel.mas_bottom).with.offset(10);
        make.bottom.equalTo(self.contentView).with.offset(-6);
        
    }];
}







- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
